package com.dragon.modules.yuegou.mapper.wallet;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dragon.modules.yuegou.entity.wallet.MemberTradeEntity;
import com.dragon.modules.yuegou.model.wallet.MemberTrade;
import com.dragon.modules.yuegou.query.wallet.TradeQuery;
import com.dragon.modules.yuegou.request.CardConsumeRecordRequest;
import com.dragon.modules.yuegou.request.CardYueLiftRecordRequest;
import com.dragon.modules.yuegou.response.CardConsumeRecordResponse;
import com.dragon.modules.yuegou.response.CardYueLiftRecordResponse;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 会员交易（在会员视角的交易流水） Mapper接口
 *
 * @author pbuilder generated
 * @date 2019-07-10 17:57:17
 * @version 2.0
 */
@Component("waltMemberTradeMapper")
public interface MemberTradeMapper extends BaseMapper<MemberTradeEntity> {

    /**
     * 集团版查询交易明细列表
     * @param page
     * @param query
     * @return
     */
    IPage<MemberTrade> searchTradeList(IPage<MemberTrade> page, @Param("query") TradeQuery query);

    /**
     * 导出集团版查询交易明细列表
     * @param query
     * @return
     */
    List<MemberTrade> searchTradeList(@Param("query") TradeQuery query);

    /**
     * 分页查询会员悦币交易记录
     * */
	IPage<MemberTrade> search(IPage<MemberTrade> page,@Param("query") MemberTrade query);

	List<MemberTrade> search(@Param("query") MemberTrade query);
	
	BigDecimal getIncome(String memberId,LocalDateTime createTimeBetweenS,LocalDateTime createTimeBetweenE);
	
	BigDecimal getPayment(String memberId,LocalDateTime createTimeBetweenS,LocalDateTime createTimeBetweenE);

    /**
     * 统计企业发票
     * @param memberTrade
     * @return
     */
    List<MemberTrade> companyInvoice(@Param("memberTrade") MemberTrade memberTrade);

    /**
     * 查询悦卡消费记录
     *
     * @param page
     * @param request
     * @return
     */
    IPage<CardConsumeRecordResponse> searchConsumeRecord(IPage<CardConsumeRecordRequest> page, @Param("request") CardConsumeRecordRequest request);

    /**
     * 查询悦卡消费记录列表
     * @param request
     * @return
     */
    List<CardConsumeRecordResponse> searchConsumeRecord(@Param("request") CardConsumeRecordRequest request);

    /**
     * 新生活悦卡消费记录表
     * @param page
     * @param request
     * @return
     */
    IPage<CardYueLiftRecordResponse> searchYueLiftRecord(IPage<CardYueLiftRecordRequest> page, @Param("request") CardYueLiftRecordRequest request);
}
